<?php 
$user=$session->read('User');
$first_ownerid=$form->value('Project.first_owner');
$is_audit=$form->value('Project.is_audit');
$isflag=false;
if($user['isadmin'] || $user['isgroupadmin'])
{
	$isflag=true;
}
else
{
	if($first_ownerid==$user['id'] && $is_audit != "1")
		$isflag = true;
}
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $form->value('Project.project_name');?></h2>
	</div>
    <div class="right back_btn"><?php 
    $HTTP_REFERER=$_SERVER["HTTP_REFERER"];
    echo $html->link("返回",$HTTP_REFERER);?></div>
    <?php
    	if($is_audit == "1")
    	{
    		echo '<div class="right enableaction">';
			echo "<a>已移交</a>";
			echo '</div>';
    	}
    	else
    	{
	    	if(($user['isadmin'] || $user['isgroupadmin']) && $is_deleted != "2")
	    	{
	    		if($first_ownerid != $user["id"] && $is_audit == "2")
	    		{
		    		echo '<div class="right back_btn">';
					//echo $html->link("移交驳回","/projects/editIsauditReject/".$id,array("onclick"=>"return rejectMove()"));
					echo "<a href='javascript:void(0)' onclick='return rejectMove()'>驳回移交</a>";
					echo '</div>';
	    		}
	    		
	    		echo '<div class="right back_btn">';
				echo "<a href='javascript:void(0)' onclick='return checkmoveproject()'>确认移交</a>";
				echo '</div>';
	    	}
	    	else if($first_ownerid == $user["id"] && ($is_audit == "0" || $is_audit == "3"))
	    	{
	    		echo '<div class="right back_btn">';
				//echo $html->link("申请移交","/projects/editIsauditAskfor/".$id,array("onclick"=>"return checkmove(this)"));
				echo "<a href='javascript:void(0)' onclick='return askForMove(this)'>申请移交</a>";
				echo '</div>';
	    	}
    	}
    	
    	
    	if(($user['isadmin'] || $user['isgroupadmin']) && $is_deleted=="2")
    	{
    		echo '<div class="right back_btn">';
			//echo $html->link("驳回删除","/projects/editIsdeletedReject/".$id,array('onclick'=>'return rejectDelete()'));
			echo "<a href='javascript:void(0)' onclick='return rejectDelete()'>驳回删除</a>";
			echo '</div>';
    	}
	?>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<div class="details_info_content">
    		<?php echo $form -> create('companys', array('url' => '/projects/moveproject/'.$id,"id"=>"companys")); ?>
	    	<?php  echo $form->hidden('Project.id'); ?>
			<div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Project Name")?>：</div>
	                <div class="form_right_input left"><?php echo $form->value('Project.project_name');?></div>
	            </div>
	        </div>
	        <div class="details_item_line">
	             <div class="details_item">
	                <div class="form_left_title left"><?php __("Company Name")?>：</div>
	                <div class="form_right_input left">
	                <?php 
	                if($user["isadmin"] || $user["isgroupadmin"])
					{
						echo $form->text('Project.company_name',array("class"=>"showedit",'style'=>'width:250px;',"maxlength"=>"100","onchange"=>"changesave(this,'company_name')"));
					}
					else
					{
						if(($is_audit == "0" || $is_audit == "3") && $first_ownerid == $user["id"])
						{
							echo $form->text('Project.company_name',array("class"=>"showedit",'style'=>'width:250px;',"maxlength"=>"100","onchange"=>"changesave(this,'company_name')"));
						}
						else 
						{
							echo $form->value('Project.company_name');
						}
					}    
	                ?>
	                </div>
	                <div id='projectcnamemessage' style='display:none;' class="error_message">企业名称已存在</div>
           			<div id='cname' style='display:none;'><?php echo $form->value('Project.company_name')?></div>
	            </div>
	        </div>
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Industry")?>：</div>
	                <div class="form_right_add left">
	                    <?php 
			            $industryidlist="";
			            if($pros_cvalues){
				            foreach($pros_cvalues as $pros_cvalue){
				            	if(!empty($pros_cvalue["cvid"])){
				            		$industryidlist.=$pros_cvalue["cvid"].',';
				            	}
				            }
			            }
			            ?>
			            <div id="pcvalueidlist" class="txthide"><?php echo $industryidlist?></div>
	                	<div id="taglist" class="added_item_list left"></div>
	                    <div class="add_item_btn left">
			                <div id="add_float_box" style="display:none;">
			                    <ul>
				                    <?php 
				                    $dan="'";
				                    foreach($industrys as $key=>$industry){
										echo "<li><label>";
										echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$industry.$dan.')" value="'.$key.'" />'.$industry;
										echo "</label></li>";
										echo "<span id='span".$key."' class='txthide'>".$industry."</span>";
									}?> 
								</ul>
			                </div>
						</div>
	                    <?php echo $form->text('Project.industryname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
	                    
			            <?php echo $form->text('Project.industryid',array('class'=>'txthide'));?>
	                </div>
	            </div>
	        </div>
	        
	         <!-- 信息来源 开始 -->
        <div class="details_item_line">
            <div class="details_item">
            	 <div class="form_left_title left">信息来源：</div>
            	 <div class="form_right_add left">
                	<?php 
		            $informationlist="";
		            if($informationfroms){
			            foreach($informationfroms as $informationfrom){
			            	if(!empty($informationfrom["cvid"])){
			            		$informationlist.=$informationfrom["cvid"].',';
			            	}
			            }
		            }
		            ?>
		            <div id="informationfromidlist" class="txthide"><?php echo $informationlist?></div>
		            <?php //debug($informationfroms);?>
                	<div id="taglistct" class="added_item_list left"></div>
                    <div class="add_item_btn left">
		                <div id="add_float_boxct" class="add_float_box" style="display:none;">
		                    <ul>
			                    <?php 
			                    $dan="'";
			                    foreach($informations as $key=>$information){
									echo "<li><label>";
									echo '<input type="checkbox" id="chbox'.$key.'" onclick="settxt(this,'.$dan.$information.$dan.','.$dan."#ProjectInformationfromname".$dan.','.$dan."#ProjectInformationfromid".$dan.','.$dan."#taglistct".$dan.')" value="'.$key.'" />'.$information;
									echo "</label></li>";
									echo "<span id='span".$key."' class='txthide'>".$information."</span>";
								}?> 
							</ul>
		                </div>
					</div>
                    <?php echo $form->text('Project.informationfromname',array('class'=>'txthide','readonly'=>'true','style'=>'width:500px'));?>
		            <?php echo $form->text('Project.informationfromid',array('class'=>'txthide'));?>
                </div>
            </div>
        </div>
        
        <!-- 信息来源 结束-->
        
         <div class="details_item_line">
        	<div class="details_item">
            	<div class="form_left_title left">负责人：</div>
            	<div class="form_right_input form_date_picker left">
            		<?php 
            			echo $accp->getusername($objusers,$first_ownerid); 
            		?>
            	</div>
            </div>
	     </div>
	         
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Regedit Time")?>：</div>
	                <div class="form_right_input form_date_picker left">
	                <?php 
	                if($user["isadmin"] || $user["isgroupadmin"])
					{
						echo $form->text('Project.reg_time',array("maxlength"=>"10","onfocus"=>"WdatePicker()","onchange"=>"changesave(this,'reg_time')","class"=>"showedit","style"=>"width:130px;"));
					}
					else
					{
						if(($is_audit == "0" || $is_audit == "3") && $first_ownerid == $user["id"])
						{
							echo $form->text('Project.reg_time',array("maxlength"=>"10","onfocus"=>"WdatePicker()","onchange"=>"changesave(this,'reg_time')","class"=>"showedit","style"=>"width:130px;"));
						}
						else 
						{
							echo $form->value('Project.reg_time');
						}
					}    
	                ?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Regedit Capital")?><span class="captype">(万)</span>：</div>
	                <div class="form_right_input left">
		                <?php echo $form->value('Project.cap_type')=="0"?"￥":"＄"?>
		                <?php 
		                    if($user["isadmin"] || $user["isgroupadmin"])
							{
								echo $form->text("Project.capital",array("onkeydown"=>"checkpricekeyup(this,event)","class"=>"showedit","style"=>"width:70px;","maxlength"=>"10","onblur"=>"changesave(this,'capital')"));
							}
							else
							{
								if(($is_audit == "0" || $is_audit == "3") && $first_ownerid == $user["id"])
								{
									echo $form->text("Project.capital",array("onkeydown"=>"checkpricekeyup(this,event)","class"=>"showedit","style"=>"width:70px;","maxlength"=>"10","onblur"=>"changesave(this,'capital')"));
								}
								else 
								{
									echo $form->value("Project.capital");
								}
							}    
		                ?>
	                </div>
	            </div>
	        </div>
	        
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Contact")?>：</div>
	                <div class="form_right_input left">
	                	<?php 
	                	  if(($user['isadmin'] || $user['isgroupadmin']) || $is_audit == "0" || $is_audit == "3"){
	                	  		echo $form->text('Project.contact',array("class"=>"showedit","maxlength"=>"20","onchange"=>"changesave(this,'contact')"));
	                	  }
	                	  else 
	                	  		echo $form->value('Project.contact');
	                	?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Tel")?>：</div>
	                <div class="form_right_input left">
	                	<?php 
	                		if(($user['isadmin'] || $user['isgroupadmin']) || $is_audit == "0" || $is_audit == "3"){
	                	  		echo $form->text('Project.tel',array("class"=>"showedit","maxlength"=>"20","onchange"=>"changesave(this,'tel')"));
	                	  	}
	                	  	else 
	                	  		echo $form->value('Project.tel');
	                	?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("Mail")?>：</div>
	                <div class="form_right_input left">
	                	<?php 
	                		if(($user['isadmin'] || $user['isgroupadmin']) || $is_audit == "0" || $is_audit == "3"){
	                			echo $form->text('Project.email',array("class"=>"showedit","style"=>"width:200px;ime-mode:disabled","maxlength"=>"50","onchange"=>"changesave(this,'email')"));
	                		}
	                		else 
	                			echo $form->value('Project.email');
	                	?>
	                </div>
	            	<?php echo $form->text('User.uemail',array("class"=>"txthide","value"=>$form->value('Project.email')));?>
	            	<div id='projectemailmessage' style='display:none;' class="error_message">邮箱格式不正确</div>
	            </div>
	        </div>
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left">性别：</div>
	                <div class="form_right_input left">
	                	<?php echo $form->value('Project.sex') == 0?"男":"女";?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left">毕业院校：</div>
	                <div class="form_right_input left">
	                	<?php echo $form->value('Project.graduate_school');?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left">学历学位：</div>
	                <div class="form_right_input left">
	                	<?php 
							$education=$form->value('Project.education');
							if($education){echo $educations[$education];}
	                	?>
	                </div>
	            </div>
	        </div>
	        
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left">出生年月：</div>
	                <div class="form_right_input left">
	                	<?php echo $form->value('Project.birthday');?>
	                </div>
	            </div>
	            <div class="details_item">
	                <div class="form_left_title left">国籍：</div>
	                <div class="form_right_input left">
	                	<?php echo $form->value('Project.nation');?>
	                </div>
	            </div>
	        </div>
	        <div class="txthide">
	        	<div class="details_item">
		        	<div class="form_left_title left"><?php __("In Phase")?>：</div>
		            <div class="form_right_input left">
		           
		            <?php 
			            $selectphase=$form->value("Project.phase");
			            echo $form->select('Project.phase',$phases,$selectphase,array("onchange"=>"selectregdecl(this)"),null);
			            echo $form->text('Project.txtphase',array('class'=>'txthide'));
		            ?>
		            <?php 
		        	echo $form->text('Project.selectphase',array('class'=>'txthide','value'=>$selectphase));
		        	?>
		        	
		            <?php 
		            	$selectregtype=$form->value("Project.reg_type");
			            echo $form->select('Project.reg_type',$reg_type,$selectregtype,
			            array("onchange"=>"selectregtypedecl(this)","id"=>"reg_type","class"=>"txthide"),null);
			            echo $form->text('Project.txtreg_type',array('class'=>'txthide'));
			        ?>
			        
			        <?php $select_phase=$form->value("Project.reg_decl_phase"); ?>
			        
		            <?php echo $form->select('Project.nreg_phase',$nreg_phase,$select_phase,
		            array("id"=>"nreg_phase","class"=>"txthide"),null);?>
		           
		        	
		        	<?php echo $form->select('Project.wreg_phase',$wreg_phase,$select_phase,
		        	array("id"=>"wreg_phase","class"=>"txthide"),null);?>
		        	
		        	
		        	<?php echo $form->select('Project.decl_phase',$decl_phase,$select_phase,
		        	array("id"=>"decl_phase","class"=>"txthide"),null);?>
		        	<?php 
		        	echo $form->text('Project.select_phase',array('class'=>'txthide1','value'=>$select_phase));
		        	?>
		        	</div>
	            </div>
	        </div>
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"><?php __("In Phase")?>：</div>
	                  <div class="form_right_stage left">
	                    <table cellpadding="0" cellspacing="0">
	                        <tr>
	                        	<?php 
	                        	$pphase_cvalue=$objproject["phase_cvalue"]["value"];//项目的各个阶段:意向，注册等
	                        	//debug($pphase_cvalue);
	                        	$preg_cvalue=$objproject["reg_cvalue"]["value"];//内资注册和外资注册
	                        	//debug($preg_cvalue);
	                        	$preg_decl_cvalue=$objproject["reg_decl_cvalue"]["value"];//内资注册或者外资注册的阶段
	                        	//debug($preg_decl_cvalue);
	                        	$remark=$form->value("Project.remark");
	                        	
	                        	?>
	                        	
	                        	<?php 
	                    			$i=0;
	                    			$j=0;
	                    			$dan="'";
	                    			if($pphase_cvalue != $Incubate)
	                    				array_pop($phases);
	                    			$phasescount=count($phases);
	                    			$selectedphase="";
	                    			$reg_phases=$preg_cvalue==$NRegistr?$nreg_phase:$wreg_phase;
	                    			$reg_phasescount=count($reg_phases);
	                        		foreach($phases as $key=>$phase)
	                        		{
	                        			$selectedphase=$key==$selectphase?"selected":"";
	                        			$strphase=$phase;
	                        			if($pphase_cvalue==$Registr && $phase==$Registr && $preg_cvalue!=""){
	                        				$strphase=$preg_cvalue;
	                        				if($reg_phasescount%2!=0){
	                        					$phasescount=$phasescount+1;
	                        				}else{
	                        					$phasescount=$phasescount+2;
	                        				}
	                        				//$selectedphase="";
	                        			}
	                        			
	                        			if($pphase_cvalue==$Declare  && $phase==$Declare && !empty($preg_decl_cvalue)){
	                        				//$selectedphase="";
	                        			}
	                        			$tblclick="";
	                        			$selectcss="";
	                        			if($pphase_cvalue==$Registr && empty($preg_cvalue)){
	                        			
	                        			}
	                        			else if((empty($preg_cvalue) && empty($preg_decl_cvalue)) || ($phase==$Declare && empty($preg_decl_cvalue)))
	                        			{
	                        				if($isflag){
		                        				$tblclick=' onclick="setphase('.$dan.$key.$dan.')" ';
		                        				$selectcss="selectcss";
	                        				}
	                        			}
	                        			if($phase==$Declare && !empty($preg_cvalue))
	                        			{
	                        				if($isflag){
		                        				$tblclick=' onclick="setphase('.$dan.$key.$dan.')" ';
		                        				$selectcss="selectcss";
	                        				}
	                        			}
	                        			if($pphase_cvalue==$Declare){
	                    					$selectcss="";
	                    					$tblclick="";
	                    				}
	                        			if($i%2==0){
	                        				?>
	                        				<td class="per_node">
				                                <table id="tbl<?php echo $key?>" class="<?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
				                                    <tr>
				                                        <td colspan="3" class="stage_bubble"></td>
				                                    </tr>
				                                    <tr>
				                                        <td class="stage_node_line">
				                                        <?php if($i!=0 ){
				                                        	?>
				                                        		<hr color="#2989e2"/>
				                                        	<?php
				                                        }?>
				                                        </td>
				                                        <td><a></a></td>
				                                        <td class="stage_node_line">
				                                        	<?php 
				                                        	if($i!=($phasescount-1) || $pphase_cvalue==$Registr){?>
					                                        	<hr color="#2989e2"/>
					                                        <?php }?>
				                                        </td>
				                                    </tr>
				                                    <tr>
				                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_down strphase"><?php echo $strphase; ?></td>
				                                    </tr>
				                                </table>
				                            </td>
	                        				<?php
	                        			}
	                        			else{
	                        				?>
	                        				<td class="per_node">
				                                <table id="tbl<?php echo $key?>" class="<?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
				                                    <tr>
				                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_up strphase"><?php echo $strphase;?></td>
				                                    </tr>
				                                    <tr>
				                                        <td class="stage_node_line"><hr color="#2989e2"/></td>
				                                        <td><a></a></td>
				                                        <td class="stage_node_line">
					                                        <?php 
					                                        if($i!=($phasescount-1) || $pphase_cvalue==$Registr){
					                                        	?>
					                                        	<hr color="#2989e2"/>
					                                        <?php }?>
				                                        </td>
				                                    </tr>
				                                    <tr>
				                                        <td colspan="3" class="stage_bubble"></td>
				                                    </tr>
				                                </table>
				                            </td>
	                        				<?php
	                        			}
	                        			if($pphase_cvalue==$Registr && $phase==$Registr && $preg_cvalue==""){
	                        				$reg_typecount=count($reg_type);
			                        		foreach($reg_type as $key=>$reg_phase)
			                        		{
			                        			$selectedphase="";
			                        			$selectcsss="";
				                        		$tblclick="";
				                        		if($isflag){
				                        			$selectcss="selectcss";
				                        			$tblclick=' onclick="setphase('.$dan.$key.$dan.')" ';
				                        		}
			                        			if($j%2==0){
			                        				?>
			                        				<td class="per_node">
						                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectcsss?> <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
						                                    <tr>
						                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_up strphase"><?php echo $reg_phase?></td>
						                                    </tr>
						                                    <tr>
						                                        <td class="stage_node_line"><hr color="#2989e2"/></td>
						                                        <td><a></a></td>
						                                        <td class="stage_node_line">
						                                        	<?php if($j!=($reg_typecount-1)){?>
						                                        	<hr color="#2989e2"/>
						                                        	<?php }?>
						                                        </td>
						                                    </tr>
						                                    <tr>
						                                        <td colspan="3" class="stage_bubble"></td>
						                                    </tr>
						                                </table>
						                            </td>
			                        				<?php
			                        			}else{
			                        				?>
			                        				<td class="per_node">
						                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectcsss?> <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
						                                    <tr>
						                                        <td colspan="3" class="stage_bubble"></td>
						                                    </tr>
						                                    <tr>
						                                        <td class="stage_node_line">
						                                        	<hr color="#2989e2"/>
						                                        </td>
						                                        <td><a></a></td>
						                                        <td class="stage_node_line">
						                                        	<?php if($j!=($reg_typecount-1)){?>
						                                        	<hr color="#2989e2"/>
						                                        	<?php }?>
						                                        </td>
						                                    </tr>
						                                    <tr>
						                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_down strphase"><?php echo $reg_phase?></td>
						                                    </tr>
						                                </table>
						                            </td>
			                        				<?php
			                        			}
			                        			$j++;
			                        		}
			                        	}
	    
	                        			if($pphase_cvalue==$Registr && $phase==$Registr && $preg_cvalue!=""){
	                        				$i++;
	                        				if($reg_phasescount%2==0){
	                        					$i++;
	                        				}
			                        		$selectedphase="";
			                        		$reg_phase=array();
			                        		if($preg_cvalue==$NRegistr){
			                        			
			                        		}
			                        		$reg_phasescount=count($reg_phases);
			                        		foreach($reg_phases as $key=>$reg_phase)
			                        		{
			                        			$selectedphase=$key==$select_phase?"selected":"";
			                        			
			                        			$titleremark="";
			                        			$strremark="";
			                        			if(stripos($reg_phase,"前置")>-1 && $remark){
				                        			$strremark="...";
				                        			$titleremark="title='".$remark."'";
				                        		}
				                        		$selectcss="";
				                        		$tblclick="";
				                        		if($isflag){
				                        			$selectcss="selectcss";
				                        			$tblclick=' onclick="setphase('.$dan.$key.$dan.',1)" ';
				                        		}
			                        			if($j%2==0){
			                        				?>
			                        				<td class="per_node">
						                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
						                                    <tr>
						                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_up strphase" <?php echo $titleremark?>><?php echo $reg_phase.$strremark?></td>
						                                    </tr>
						                                    <tr>
						                                        <td class="stage_node_line"><hr color="#2989e2"/></td>
						                                        <td><a></a></td>
						                                        <td class="stage_node_line">
						                                        	<?php if($j!=($reg_phasescount-1)){?>
						                                        	<hr color="#2989e2"/>
						                                        	<?php }?>
						                                        </td>
						                                    </tr>
						                                    <tr>
						                                        <td colspan="3" class="stage_bubble"></td>
						                                    </tr>
						                                </table>
						                            </td>
			                        				<?php
			                        			}else{
			                        				?>
			                        				<td class="per_node">
						                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
						                                    <tr>
						                                        <td colspan="3" class="stage_bubble"></td>
						                                    </tr>
						                                    <tr>
						                                        <td class="stage_node_line">
						                                        	<hr color="#2989e2"/>
						                                        </td>
						                                        <td><a></a></td>
						                                        <td class="stage_node_line">
						                                        	<?php if($j!=($reg_phasescount-1)){?>
						                                        	<hr color="#2989e2"/>
						                                        	<?php }?>
						                                        </td>
						                                    </tr>
						                                    <tr>
						                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_down strphase" <?php echo $titleremark?> ><?php echo $reg_phase.$strremark?></td>
						                                    </tr>
						                                </table>
						                            </td>
			                        				<?php
			                        			}
			                        			$j++;
			                        		}
			                        	}
	                        			$i++;
	                        		}
	                        	?>
	                        	<?php 
	                        	if($pphase_cvalue==$Declare){
	                        		$j=0;
	                        		$selectedphase="";
	                        		$decl_phasecount=count($decl_phase);
	                        		foreach($decl_phase as $key=>$decl_phases)
	                        		{
	                        			$selectedphase=$key==$select_phase?"selected":"";
	                        			$selectcss="";
		                        		$tblclick="";
		                        		if($isflag){
		                        			$selectcss="selectcss";
		                        			$tblclick=' onclick="setphase('.$dan.$key.$dan.',1)" ';
		                        		}
	                        			if($j%2!=0){
	                        				?>
	                        				<td class="per_node">
				                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
				                                    <tr>
				                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_up strphase"><?php echo $decl_phases?></td>
				                                    </tr>
				                                    <tr>
				                                        <td class="stage_node_line"><hr color="#2989e2"/></td>
				                                        <td><a></a></td>
				                                        <td class="stage_node_line">
				                                        	<?php if($j!=($decl_phasecount-1)){?>
				                                        	<hr color="#2989e2"/>
				                                        	<?php }?>
				                                        </td>
				                                    </tr>
				                                    <tr>
				                                        <td colspan="3" class="stage_bubble"></td>
				                                    </tr>
				                                </table>
				                            </td>
	                        				<?php
	                        			}else{
	                        				?>
	                        				<td class="per_node">
				                                <table id="tbl<?php echo $key?>" class="subphase <?php echo $selectedphase?>" cellpadding="0" cellspacing="0">
				                                    <tr>
				                                        <td colspan="3" class="stage_bubble"></td>
				                                    </tr>
				                                    <tr>
				                                        <td class="stage_node_line">
				                                        	<hr color="#2989e2"/>
				                                        </td>
				                                        <td><a></a></td>
				                                        <td class="stage_node_line">
				                                        	<?php if($j!=($decl_phasecount-1)){?>
				                                        	<hr color="#2989e2"/>
				                                        	<?php }?>
				                                        </td>
				                                    </tr>
				                                    <tr>
				                                        <td colspan="3" <?php echo $tblclick?> class="<?php echo $selectcss?> stage_bubble stage_bubble_down strphase"><?php echo $decl_phases?></td>
				                                    </tr>
				                                </table>
				                            </td>
	                        				<?php
	                        			}
	                        			$j++;
	                        		}
	                        	}?>
	                        </tr>
	                    </table>
	                </div>
	           </div>
	        </div>
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left"></div>
	                <div class="left pharas_color_details">
						<ul>
							<li>
								<div class="color_block_n left"></div>
								<div class="color_block_intro left">项目阶段结点</div>
								<div class="clear"></div>
							</li>
							<li>
								<div class="color_block_s left"></div>
								<div class="color_block_intro left">项目阶段子阶段结点</div>
								<div class="clear"></div>
							</li>
							<li>
								<div class="color_block_t left"></div>
								<div class="color_block_intro left">当前项目阶段结点</div>
								<div class="clear"></div>
							</li>
						</ul>
					</div>
	            </div>
	        </div>
	        <?php if($isflag){?>
		    <div class="details_item_line">
		    	<div class="details_item" id="examineremark" style="display:none">
		        	<div class="form_left_title left">前置审批备注：</div>
		        	<div class="form_right_ajax_input left">
		        		<?php echo $form->textarea('Project.remark',array("onblur"=>"editremark(this)",'style'=>'width:200px;height:50px'));?>
		        		<div id="setremark" style="display:none"><?php echo $form->value('Project.remark')?></div>
		        	</div>
		        </div>
		    </div>
		    <?php }?>
		   
		     <?php echo $form->hidden('editIsauditAskFor') ?>
		     <?php echo $form->hidden('rejectDelete') ?>
		     <?php if(!empty($attachments)){?>
		    <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left">电子材料：</div>
	                <div class="form_right_input left">
	                	<?php ?>
	                	<div class="file_category_list">
			        		<div id="filelist0" class="file_lists">
			        			<ul class="file_attach">
				                	<?php
				                	$ised=$action->checkPermissions($user,"edit",$first_ownerid);
	        						if(empty($ised)){
			                			if(!empty($competences)){
			                				foreach($competences as $competence){
			                					if($attachments){
								                	$dan="'";
								                	$i=0;
								                	foreach($attachments as $attachment) {
								                	if($competence["visible"]==$attachment["cvid"]){
														echo "<li>";
														if($is_audit != "1")
														{
															if(($user["isadmin"] || $user["isgroupadmin"]) || $is_audit == "0" || $is_audit == "3")
															{	
																$checked = "";
																if($attachment["is_submit"] == "1") $checked = "checked";
																echo '<span>'.$form->checkbox('fileidlist.'.$i,array('value'=>$attachment['id'],'checked'=>$checked)).'</span>';
															}
														}
														echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
														echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
														echo "</li>";
														$i++;
														}
													} 
												}
											}
										}
									}else{if(!empty($attachments)){
						                	$dan="'";
						                	$i=0;
						                	foreach($attachments as $attachment) {
												echo "<li>";
												if($is_audit != "1")
												{
													if(($user["isadmin"] || $user["isgroupadmin"]) || $is_audit == "0" || $is_audit == "3")
													{	
														$checked = "";
														if($attachment["is_submit"] == "1") $checked = "checked";
														echo '<span>'.$form->checkbox('fileidlist.'.$i,array('value'=>$attachment['id'],'checked'=>$checked)).'</span>';
													}
												}
												echo "<span>".$html->link($attachment["file_name"],'/projects/download/'.$attachment["id"],null)."</span>";
												echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
												echo "</li>";
												$i++;
												}
											}else{echo "暂无文件";}
										}
				                	?>
				                </ul>
			                </div>
			            </div>
			        </div>
			    </div>
		    </div>
		    <?php }?>
		    
		  <div class="details_item_line">
		  	<?php if($is_deleted != "2"){?>
            <div class="details_item">
            	<div class="form_left_title left">移交状态：</div>
            	<div class="form_right_input form_date_picker left">
            		<?php 
            			$audit_state = $str->getStateValue($is_audit)."移交";
            			echo $audit_state; 
            		?>
            	</div>
            </div>
            <?php }?>
            
            <?php if(($is_deleted == "2" || $is_deleted == "3") && $is_audit != "2"){?>
             <div class="details_item">
	            	<div class="form_left_title left">删除状态：</div>
	            	<div class="form_right_input form_date_picker left">
	            		<?php 
	            			$delete_state = $str->getStateValue($is_deleted)."删除";
	            			echo $delete_state; 
	            		?>
	            	</div>
	         </div>
	         <?php }?>
	         
          </div>
          
         <div class="details_item_line">
        
            <div class="details_item">
             <?php if(($is_audit == "2" || $is_audit == "3") && ($is_deleted != "2")){?> 
            	<div class="form_left_title left"><font color='blue'>驳回移交原因：</font></div>
            	<div class="form_right_input left">
            		<?php 
	                	  if(($user['isadmin'] || $user['isgroupadmin'])){
	                	  		echo $form->textarea('Project.unaudit_reason',array("class"=>"showedit","maxlength"=>"200","onchange"=>"changesave(this,'unaudit_reason')"));
	                	  }
	                	  else 
	                	  		echo $form->value('Project.unaudit_reason');
	                ?>
            	</div>
            	<div id='unaduitmessage' style='display:none;' class="error_message">请填写驳回移交的原因</div>
           	 <?php }?>
            
            </div>
           
             <!-- && $is_audit != "2"  --> 
            <?php if(($is_deleted == "2" || $is_deleted == "3")){?>
	            <div class="details_item">
	            	<div class="form_left_title left"><font color='blue'>驳回删除原因：</font></div>
	            	<div class="form_right_input left">
	            		<?php 
		                	  if(($user['isadmin'] || $user['isgroupadmin'])){
		                	  		echo $form->textarea('Project.undelete_reason',array("class"=>"showedit","maxlength"=>"200","onchange"=>"changesave(this,'undelete_reason')"));
		                	  }
		                	  else 
		                	  		echo $form->value('Project.undelete_reason');
		                ?>
	            	</div>
	            	<div id='undeletemessage' style='display:none;' class="error_message">请填写驳回删除的原因</div>
	            </div>
	        <?php }?>
          </div>
          
		</form>
		</div>
    </div>
</div>
<?php echo $this->element('constant') ?>
<?php echo $javascript->link('project.js');?>
<?php echo $this->element('actionconfirm',array("title"=>"阶段设置提示","message"=>"你确定吗？")) ?>
<script>
	var webpath=$("#getpath").attr('href');
	function editremark(obj)
	{
		$(obj).parent('.form_right_ajax_input').addClass("form_right_e_input");
		$(obj).parent('.form_right_ajax_input').removeClass("form_right_ajax_input");
		var pid=$("#ProjectId").val();
		var remark=$("#ProjectRemark").val();
		var setremark=$("#setremark").html();
		if(remark!="" && remark!=setremark){
		var urlpath=webpath+'projects/editremark/'+pid+'/'+encodeURIComponent(remark);
			$.ajax({     	   
			        url: urlpath, 
			        success:function(data){
			        	$("#tbl"+aid).find(".strphase").attr("title",data);
			        	$("#setremark").html(data.trim());
			        	showmessage("前置审批备注保存成功");
			        }      
			     });
		}
	}
	function checkmove(obj)
	{
		if($("#ProjectCompanyName").val().trim()==""){
			showmessage("企业名称不能为空","F");
			return false;
		}
		if($("#ProjectContact").val().trim()==""){
			showmessage("联系人不能为空","F");
			return false;
		}
		if($("#ProjectTel").val().trim()==""){
			showmessage("联系电话不能为空","F");
			return false;
		}
		if($("#ProjectEmail").val().trim()==""){
			showmessage("联系邮箱不能为空","F");
			return false;
		}
		if(!checkEmail($("#ProjectEmail").val().trim())){
			showmessage("联系邮箱格式不正确","F");
			return false;
		}
		if($("#ProjectRegTime").val().trim()==""){
			showmessage("注册时间不能为空","F");
			return false;
		}
		if($("#ProjectCapital").val().trim()=="" || $("#ProjectCapital").val().trim()=="0.00"){
			showmessage("注册资金不能为0","F");
			return false;
		}
		if($("#projectcnamemessage").css('display')=="block"){
			return false;
		}
		if($("#projectemailmessage").css('display')=="block"){
			return false;
		}
		return true;
	}

	//检查驳回移交原因是否为空
	function checkUnauditReason()
	{
		if($("#ProjectUnauditReason").val().trim() == "")
		{
			$("#unaduitmessage").css('display','block');
			$("#ProjectUnauditReason").focus();
			return false;
		}
		return true;
	}

	//检查驳回删除原因是否为空
	function checkUndeleteReason()
	{
		if($("#ProjectUndeleteReason").val().trim() == "")
		{
			$("#undeletemessage").css('display','block');
			$("#ProjectUndeleteReason").focus();
			return false;
		}
		return true;
	}

	//点击驳回删除时
	function rejectDelete()
	{
		if(checkUndeleteReason()){
			$("#companysRejectDelete").val("2");
			$("#ui-dialog-title-1").html("驳回删除提示");
			$(".confirm_model").dialog( "open" );
			$("#ok").click(function() {
				$(".confirm_model").dialog( "close" );
				$("#companys").submit();
			});
		}
		return false;
	}

	//点击驳回移交时
	function rejectMove()
	{
		if(checkUnauditReason()){
			$("#companysEditIsauditAskFor").val("2");
			$("#ui-dialog-title-1").html("驳回移交提示");
			$(".confirm_model").dialog( "open" );
			$("#ok").click(function() {
				$(".confirm_model").dialog( "close" );
				$("#companys").submit();
			});
		}
		return false;
	}
	
	function askForMove(obj)
	{
		if(checkmove(obj)){
			$("#companysEditIsauditAskFor").val("1");
			$("#ui-dialog-title-1").html("申请移交提示");
			$(".confirm_model").dialog( "open" );
			$("#ok").click(function() {
				$(".confirm_model").dialog( "close" );
				$("#companys").submit();
			});
		}
		return false;
	}

	//确认移交
	function checkmoveproject() {
		if(checkmove(obj)){
			$("#ui-dialog-title-1").html("移交项目提示");
			$(".confirm_model").dialog( "open" );
			$("#ok").click(function() {
				$(".confirm_model").dialog( "close" );
				$("#companys").submit();
			});
		}
		return false;
	}
	
	function changesave(obj,column)
	{
		var pid=$("#ProjectId").val();
		var contentvalue=obj.value.trim();
		var str="";
		if(column=="company_name"){
			str="企业名称";
			if($("#projectcnamemessage").css('display')=="block"){
				return;
			}
		}else if(column=="contact"){
			str="联系人";
		}else if(column=="tel"){
			str="联系电话";
		}else if(column=="email"){
			str="联系邮箱";
			if($("#projectemailmessage").css('display')=="block"){
				return;
			}
		}else if(column=="reg_time"){
			str="注册时间";
		}else if(column=="capital"){
			str="注册资金";
		}
		else if(column=="unaudit_reason"){
			str="驳回移交原因";
		}
		else if(column=="undelete_reason"){
			str="驳回删除原因";
		}
		var fg=true;
		if(contentvalue!=""){
			if(column=="email"){
				if(!checkEmail(contentvalue)){
					fg=false;
				}
			}
			if(fg){
				$.ajax({     	   
			    	url: webpath+'projects/changesave/'+pid+'/'+column+'/'+encodeURIComponent(contentvalue), 
			        success:function(data){
			        	showmessage(str+"保存成功");
			        	if(column=="company_name"){
							$('#cname').html(contentvalue);
				        }
			        }       
			     });
		     }
	    }
	}
	$(document).ready(function() {
		$("#ProjectCompanyName").keyup(function() {    		
			var cname=this.value;
			if(cname.trim()!=""){
	   			var cnames=$("#cname").html();
	   			if(cnames!=cname){
		   			var urlpath=webpath+'projects/checkcname/'+encodeURIComponent(cname);
					$.ajax({     	   
				        url: urlpath, 
				        success:function(data){
				        	if(data=="1")
				        	{
				        		$("#projectcnamemessage").css('display','block');
				        	}else{
				        		$("#projectcnamemessage").css('display','none');
				        	}
				        }
				    });
			    }else{
			    	$("#projectcnamemessage").css('display','none');
			    }
		    }
	    });
		$("#ProjectEmail").keyup(function() {  
	     	var mail=this.value;
	     	var umail=$("#UserUemail").val();
		 	checkuserbymail(webpath,mail,umail,"#projectemailmessage");
	    });
	});
</script>